//
//  MSRecommenDetailVC.m
//  SocietySale
//
//  Created by Mike on 16/11/30.
//  Copyright © 2016年 Mike. All rights reserved.
//

#import "MSRecommenDetailVC.h"
#import "MSRecommenDetailTableVC.h"

@interface MSRecommenDetailVC ()
@property (nonatomic, strong) MSRecommenDetailTableVC *tableVC;

@end

@implementation MSRecommenDetailVC

- (void)initNavigationBar{
    [super initNavigationBar];
    leftBarBtn.hidden = NO;
    titleLable.text = @"客户引荐";
}

- (void)initUI{
    self.tableVC = [[MSRecommenDetailTableVC alloc] initWithStyle:UITableViewStyleGrouped];
    self.tableVC.view.frame = self.contentView.bounds;
    self.tableVC.enableRefresh = NO;
    self.tableVC.enableRequest = NO;
    self.tableVC.delegate = (id)self;
    self.tableVC.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.contentView addSubview:self.tableVC.view];
}

- (void)testDataFunc{
    MSDetailContactModel *model = _model;//[[MSDetailContactModel alloc] init];
//    model.otherProject = @"扬子巴士承接项目";
//    model.name = @"周长生";
//    model.company = @"上海电力有限公司";
//    model.position = @"项目经理";
//    model.telephone = @"185 7665 8374";
//    model.address = @"上海市宝山区友谊路";
//    model.source = @"来自手机通讯录";
    
    MSProjectModel *model1 = [[MSProjectModel alloc] init];
    model1.title = @"苏州永华置业有限公司 意境鸣镝西部仓库";
    model1.projectType =  @"酒店";
    model1.projectState =  @"主体施工";
    model1.investment =  @"3亿";
    model1.address =  @"苏州";
    model1.time =  @"2016.10-2016.12";
    model1.introduction =  @"项目经理";
    
    MSProjectModel *model2 = [[MSProjectModel alloc] init];
    model2.title = @"中国光大国际有限公司深圳办事处";
    model2.projectType =  @"市政公用";
    model2.projectState =  @"主体施工";
    model2.investment =  @"6亿";
    model2.address =  @"成都";
    model2.time =  @"2016.9-2016.11";
    model2.introduction =  @"规划部";
    
    NSArray *sectionArray1 = @[[DOKeyValue key:@"项目" value:model.projectName],
                               [DOKeyValue key:@"公司" value:model.company],
                               [DOKeyValue key:@"职位" value:model.position],
                               [DOKeyValue key:@"电话" value:model.telephone],
                               [DOKeyValue key:@"地址" value:model.address],
                               ];
    
    self.tableVC.model = _model;
//    self.tableVC.dataArray = [@[sectionArray1,@[model1,model2,model1],@[model,model,model]] mutableCopy];
    self.tableVC.dataArray = [@[sectionArray1,@[],@[]] mutableCopy];
    
    [netEngine requestContactsOtherProjectWithTarget:self.VctrID hudView:self.contentView contactsId:_model.peopleId params:@{@"pageNo":@"1",@"pageSize":@"10"}];
    [netEngine requestMayKnowPersonWithTarget:self.VctrID hudView:self.contentView contactsId:_model.peopleId];
}
    
#pragma mark - getData
- (void)updateViewController:(NSNotification *)note
{
    NSDictionary *responseDic = note.userInfo;
    if (responseDic[Receiver]==self.VctrID) {
        if (responseDic[@"ContactsOtherProject"]!=nil){
            NSArray *tempArray = responseDic[@"ContactsOtherProject"];
            [self.tableVC.dataArray replaceObjectAtIndex:1 withObject:tempArray];
            [self.tableVC.tableView reloadData];
        }
        if (responseDic[@"MayKnowPerson"]!=nil){
            [self.tableVC.dataArray replaceObjectAtIndex:2 withObject:responseDic[@"MayKnowPerson"]];
            [self.tableVC.tableView reloadData];
        }
    }
}

@end
